package com.base.api.controller.commodityReferrer;

import com.base.api.dto.commodityReferrer.ReferrerListDTO;
import com.base.api.service.commodityReferrer.CommodityReferrerApiService;
import com.base.api.vo.commodityReferrer.ReferrerVO;
import com.base.log.WebLog;
import com.base.result.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@Slf4j
@RequestMapping("/api/commodityReferrer")
@Api(tags = "商品推荐")
public class CommodityReferrerApiController {

    private final CommodityReferrerApiService commodityReferrerApiService;

    public CommodityReferrerApiController(CommodityReferrerApiService commodityReferrerApiService) {
        this.commodityReferrerApiService = commodityReferrerApiService;
    }

    @ApiOperation(value="商品推荐查询")
    @PostMapping(value = "/referrerList", produces = "application/json;charset=UTF-8")
    @Validated
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK", response = ReferrerVO.class),
    })
    @WebLog
    public ResponseResult referrerList(final @Valid ReferrerListDTO referrerListDTO){
        return commodityReferrerApiService.referrerList(referrerListDTO);
    }


}
